package com.pluto.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class R {

	private Integer code;
	private String msg;
	private Object data;

	public static R ok(Object data) {
		return new R(200, "success", data);
	}

	public static R ok(String msg, Object data) {
		return new R(200, msg, data);
	}

	public static R ok(Integer code, String msg, Object data) {
		return new R(code, msg, data);
	}


	public static R error(Object data) {
		return new R(500, "error", data);
	}

	public static R error(String msg, Object data) {
		return new R(500, msg, data);
	}

	public static R error(Integer code, String msg, Object data) {
		return new R(code, msg, data);
	}
}
